package cn.dai.controller.api;

import cn.dai.service.TestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author daijiyong
 */
@RestController
@RequestMapping("/api/test")
public class TestController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    private TestService testService;

    @RequestMapping("/success")
    public String test() {
        logger.info("数据接口测试成功！！！");
        testService.test();
        return "数据测试成功";
    }

    @RequestMapping("/fail")
    public void fail() {
        throw new RuntimeException("异常测试");
    }

}
